package misc;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import static com.google.common.base.CaseFormat.LOWER_UNDERSCORE;
import static com.google.common.base.CaseFormat.UPPER_CAMEL;

public class Utils {
    public static final Gson GSON = new GsonBuilder()
            .setPrettyPrinting()
            .create();
    public static final Folder DATA_FOLDER = new Folder("data");

    public static String createName(Class<?> aClass, String... affixes) {
        String name = aClass.getSimpleName();

        for (String affix : affixes)
            name = name.replaceAll(affix, "");

        if (name.length() == 0)
            return name;

        final char c = name.charAt(0);

        name = UPPER_CAMEL
                .to(LOWER_UNDERSCORE, name)
                .replace("_", " ");

        return c + name.substring(1);
    }
}
